namespace app\<?=$module_name?>\model;

use app\comm\model\BaseModel;
use think\Db;
use think\Paginator;
class <?=$tpTableName?> extends BaseModel{
    //新增数据之前的方法
    public function beforeSave(&$data){

    }

    //新增数据之后的方法
    public function afterSave($id){

    }

    //修改数据之前的方法
    public function beforeEdit(&$data){

    }

    //修改数据之后的方法
    public function afterEdit($id){

    }

    //删除数据之前的方法
    public function beforeDel($id){

    }

    //删除数据之后的方法
    public function afterDel($id){

    }


    //列表分页的方法
    public function search($pageone = 10){
        $where = [];
<?php
     if(!empty($config['search'])){
        foreach($config['search'] as $k=>$v){ ?>
        if($<?=$v['field']?> = input('get.<?=$v['field']?>')){
            <?php if($v['field'] == $pri_key){?>
                $where["<?=$pri_key?>"] = array("eq",$<?=$pri_key?>);
            <?php }else{ ?>
                $where["<?=$v['field']?>"] = array("like","%$<?=$v['field']?>%");
            <?php } ?>
        }

<?php
        }
    }
?>

        $list = $this::where($where)->paginate($pageone,false,['query'=>request()->param()]);
        $page = $list->render();
        $data['data'] = $list;
        $data['page'] = $page;
        return $data;
    }
}